cmake_minimum_required(VERSION 2.6)
project(Xow)

if (WIN32)
add_definitions(-D__WIN32__)
add_definitions(-D_WIN32_WINNT=0x0501)
add_definitions(-D__LCC__)
add_definitions(-W3)
else()
message(FATAL_ERROR "Only support WIN32")
endif()

set(DEPDIR ${PROJECT_SOURCE_DIR}/Dep)
if (WIN32)
    set(DEPWIN32DIR ${DEPDIR}/win32)
    string(COMPARE EQUAL ${CMAKE_GENERATOR} "Visual Studio 10 2010" IS_VS10)
    string(COMPARE EQUAL ${CMAKE_GENERATOR} "Visual Studio 14 2015" IS_VS15)
    if (IS_VS10)
        set(VSVER "vs10")
    elseif(IS_VS15)
        set(VSVER "vs15")
    endif()
    # boost
    set(BOOST_INC ${DEPDIR}/boost)
    set(BOOST_LIB "" CACHE PATH "boost library directory")
    ## libevent
    set(LIBEVENT_INC ${DEPWIN32DIR}/libevent/include)
    set(LIBEVENT_LIB ${DEPWIN32DIR}/libevent/lib/${VSVER})
    set(LIBEVENT_LIBRARIES libevent libevent_core libevent_extras)
    ## mysql
    set(MYSQL_INC ${DEPWIN32DIR}/mysql/include)
    set(MYSQL_LIB ${DEPWIN32DIR}/mysql/lib)
    set(MYSQL_LIBRARIES libmysql)
    ## openssl
    set(OPENSSL_INC ${DEPWIN32DIR}/openssl)
    set(OPENSSL_LIB ${DEPWIN32DIR}/openssl/lib)
    set(OPENSSL_LIBRARIES libeay32)
endif()

include_directories(
    ${BOOST_INC}
    ${LIBEVENT_INC}
    ${MYSQL_INC}
    ${OPENSSL_INC}
    ${PROJECT_SOURCE_DIR}
)

link_directories(
    ${BOOST_LIB}
    ${LIBEVENT_LIB}
    ${MYSQL_LIB}
    ${OPENSSL_LIB}
)

add_subdirectory(Shared)